package com.cell.api.application.netty.coder;

import com.cell.api.application.netty.code.Packet;
import com.cell.api.application.netty.utils.CoderUtils;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * <p>
 * 编码
 * </p>
 *
 * @author zdy
 * @date 2021/11/8
 */
public class PacketEncoder extends MessageToByteEncoder<Packet> {
    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, Packet packet, ByteBuf byteBuf) throws Exception {
        CoderUtils.encode(byteBuf, packet);
    }
}
